<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>Hyves.net - Always in touch with your friends</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link href="<%=basePath%>/style/main.css" type="text/css"
			rel="stylesheet" />
		<link href="<%=basePath%>/style/style20.css" type="text/css"
			rel="stylesheet" />
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>/style/admin_style.css" />
		<script language="javascript"
			src="<%=basePath%>/script/jquery1.3.2.js" type="text/javascript"></script>
		<script language="javascript"
			src="<%=basePath%>/script/jquery.form.js" type="text/javascript"></script>
		<script language="javascript" type="text/javascript">
				function nedit(id,name){
					$("#sort-name").val(unescape(name));
					$("#newsSortSubmitBtn").val("修改");
					$("#sort-id").val(id);
					$("#newsSortForm").attr("action","<%=basePath%>/news/updateSort");
				}
				function ndelete(id){
					$.ajax({
						type : "POST",
						dataType : "html",
						url : "<%=basePath%>/news/deleteSort",
						data : {
							id : id
						},
						success : function() {
							alert('删除成功');
							location.reload();
						}
					});
				}
				$(function(){
					/* 新建栏目的ajax表单提交 */
					$('#newsSortSubmitBtn').click(function() {
						$("#newsSortForm").ajaxSubmit({success : function(data) {
								alert($("#newsSortSubSubmitBtn").val()+"成功!");
								location.reload();
							}});
							return false;
						});
				});
		</script>
	</head>
	<body>
		<div class="generalbox overview_block">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					新闻栏目设置
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<table class="pn-ftable" width="100%" cellspacing="1"
						cellpadding="0" border="0" align="center">
						<thead class="pn-lthead" align="center">
							<tr>
								<th>
									ID
								</th>
								<th>
									分类名称
								</th>
								<th>
									文档数量
								</th>
								<th>
									创建日期
								</th>
								<th>
									操作
								</th>
							</tr>
						</thead>
						<tbody class="pn-ltbody">
							<s:iterator value="newsSortList" id="nsl">
								<tr id="result">
									<td>
										${nsl.id }
									</td>
									<td id="nsl-name">
										${nsl.name }
									</td>
									<td>
										${nsl.news.size() }
									</td>
									<td>
										${nsl.created }
									</td>
									<td class="pn-lopt">
										<a href="javascript:nedit(${nsl.id },escape('${nsl.name }'));"
											class="pn-loperator">修改</a>┆
										<a href="javascript:ndelete(${nsl.id });" class="pn-loperator">删除</a>
									</td>
								</tr>
							</s:iterator>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<br />
		<br />
		<div class="generalbox overview_block">
			<div
				class="generalbox_header overview_veryunevenlargecolumn_width generalbox_header_heavy">
				<div class="box_leftheader generalbox_leftheader">
					<img class="inlineicon transparentpng" height="16" alt=""
						src="<%=basePath%>/images/document.png" width="16" />
					新闻栏目操作
				</div>
				<div class="clearer"></div>
			</div>
			<div
				class="generalbox_body generalbox_background_white overview_veryunevenlargecolumn_width">
				<div class="singlecontent_block">
					<form action="<%=basePath%>/news/addSort" method="post"
						id="newsSortForm">
						<input type="hidden" id="sort-id" name="id" />
						<table class="pn-ltable" width="50%" cellspacing="1"
							cellpadding="0" border="0" align="center">
							<tr>
								<td>
									栏目名称：
								</td>
								<td>
									<input id="sort-name" type="text" name="newsSort.name" />
								</td>
								<td valign="top" class="BodyTextSmall" colspan="2" align="right">
									<input type="button" id="newsSortSubmitBtn" value="添加"/>
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
		<div style="margin-bottom: 338px"></div>
	</body>
</html>